package com.hlk.hlk_blog.service;


import com.hlk.hlk_blog.dao.TypeMapper;
import com.hlk.hlk_blog.entity.Type;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by limi on 2017/10/16.
 */
@Service
public class TypeServiceImpl implements TypeService {
    @Autowired
    private TypeMapper typeMapper;

    @Override
    public List<Type> findType(Integer typeNums) {
        return typeMapper.findType(typeNums);
    }

    @Override
    public List<Type> getAllType() {
        return typeMapper.getAllType();
    }

    @Override
    public Long getMaxTypeId() {
        return typeMapper.getMaxTypeId();
    }

    @Override
    public Type getTypeById(Long id) {
        return typeMapper.getTypeById(id);
    }

    @Override
    public Type getTypeByname(String name) {
        return typeMapper.getTypeByname(name);
    }

    @Override
    public boolean saveType(Type type) {
        return typeMapper.saveType(type);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public boolean updateType(Type type) {
        return typeMapper.updateType(type);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public boolean delectType(Long id) {
        return typeMapper.delectType(id);
    }
}
